package com.laowang.project.system.service.impl;

import java.util.Collections;
import java.util.List;

import com.laowang.common.utils.DateUtils;
import com.laowang.project.system.domain.vo.ZcRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.laowang.project.system.mapper.ZcWxUserMapper;
import com.laowang.project.system.domain.ZcWxUser;
import com.laowang.project.system.service.ZcWxUserService;

/**
 * H5用户Service业务层处理
 *
 * @author laowang
 * @date 2025-09-09
 */
@Service
public class ZcWxUserServiceImpl implements ZcWxUserService {
    @Autowired
    private ZcWxUserMapper zcWxUserMapper;

    /**
     * 查询H5用户
     *
     * @param id H5用户ID
     * @return H5用户
     */
    @Override
    public ZcWxUser selectZcWxUserById(Integer id) {
        return zcWxUserMapper.selectZcWxUserById(id);
    }

    /**
     * 查询H5用户列表
     *
     * @param zcWxUser H5用户
     * @return H5用户
     */
    @Override
    public List<ZcWxUser> selectZcWxUserList(ZcWxUser zcWxUser) {
        return zcWxUserMapper.selectZcWxUserList(zcWxUser);
    }

    /**
     * 新增H5用户
     *
     * @param zcWxUser H5用户
     * @return 结果
     */
    @Override
    public int insertZcWxUser(ZcWxUser zcWxUser) {
        zcWxUser.setCreateTime(DateUtils.getNowDate());
        return zcWxUserMapper.insertZcWxUser(zcWxUser);
    }

    /**
     * 修改H5用户
     *
     * @param zcWxUser H5用户
     * @return 结果
     */
    @Override
    public int updateZcWxUser(ZcWxUser zcWxUser) {
        zcWxUser.setUpdateTime(DateUtils.getNowDate());
        return zcWxUserMapper.updateZcWxUser(zcWxUser);
    }

    /**
     * 批量删除H5用户
     *
     * @param ids 需要删除的H5用户ID
     * @return 结果
     */
    @Override
    public int deleteZcWxUserByIds(Integer[] ids) {
        return zcWxUserMapper.deleteZcWxUserByIds(ids);
    }

    /**
     * 删除H5用户信息
     *
     * @param id H5用户ID
     * @return 结果
     */
    @Override
    public int deleteZcWxUserById(Integer id) {
        return zcWxUserMapper.deleteZcWxUserById(id);
    }

    @Override
    public ZcWxUser getByOpenid(String openid) {
        return zcWxUserMapper.getByOpenid(openid);
    }

    @Override
    public List<ZcRecordVo> getZcRecord(Integer userId) {
        return zcWxUserMapper.getZcRecord(userId);
    }
}
